package com.optimize.elasticsearch.entry;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * <p>
 * 地面小时数据表
 * </p>
 *
 * @author zx
 * @since 2024-09-25
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("original_hour")
public class OriginalHour implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 年
     */
    @TableField("year")
    private Long year;

    /**
     * 月
     */
    @TableField("month")
    private Integer month;

    /**
     * 日
     */
    @TableField("day")
    private Integer day;

    /**
     * 时
     */
    @TableField("hour")
    private Integer hour;

    /**
     * 综合时间
     */
    @TableField("syn_time")
    private String synTime;

    /**
     * 站点级别
     */
    @TableField("station_level")
    private String stationLevel;

    /**
     * 站点类型
     */
    @TableField("station_type")
    private String stationType;

    /**
     * 区站号
     */
    @TableField("station")
    private String station;

    /**
     * 经度
     */
    @TableField("lon")
    private Double lon;

    /**
     * 维度
     */
    @TableField("lat")
    private Double lat;

    /**
     * 最大风速
     */
    @TableField("max_wind")
    private Double maxWind;

    /**
     * 最大风速出现时间
     */
    @TableField("max_wind_time")
    private String maxWindTime;

    /**
     * 极大风速
     */
    @TableField("ext_wind")
    private Double extWind;

    /**
     * 极大风速出现时间
     */
    @TableField("ext_wind_time")
    private String extWindTime;

    /**
     * 最高温度
     */
    @TableField("max_temp")
    private Double maxTemp;

    /**
     * 最高温度出现时间
     */
    @TableField("max_temp_time")
    private String maxTempTime;

    /**
     * 最低气温
     */
    @TableField("min_temp")
    private Double minTemp;

    /**
     * 最低气温出现时间
     */
    @TableField("min_temp_time")
    private String minTempTime;

    /**
     * 过去24小时最低温度
     */
    @TableField("past24_min_temp")
    private Double past24MinTemp;

    /**
     * 过去24小时最高温度
     */
    @TableField("past24_max_temp")
    private Double past24MaxTemp;


    /**
     * 是否有效 1删除 0未删除
     */
    @TableField("vaild")
    private Integer vaild;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Long getYear() {
        return year;
    }

    public void setYear(String year) {
        year = year.replace(",", "");
        this.year = Long.valueOf(year);
    }

    public Integer getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = Integer.valueOf(month);
    }

    public Integer getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = Integer.valueOf(day);
    }

    public Integer getHour() {
        return hour;
    }

    public void setHour(String hour) {
        this.hour = Integer.valueOf(hour);
    }

    public String getSynTime() {
        return synTime;
    }

    public void setSynTime(String synTime) {
        this.synTime = synTime;
    }

    public String getStationLevel() {
        return stationLevel;
    }

    public void setStationLevel(String stationLevel) {
        this.stationLevel = stationLevel;
    }

    public String getStationType() {
        return stationType;
    }

    public void setStationType(String stationType) {
        this.stationType = stationType;
    }

    public String getStation() {
        return station;
    }

    public void setStation(String station) {
        this.station = station;
    }

    public Double getLon() {
        return lon;
    }

    public void setLon(String lon) {
        if (lon.equals("999,999") || lon.equals("999,998")) {
            this.lon = Double.valueOf(999);
            this.vaild = 1;
        } else if (lon.equals("")) {
            this.lon = 0.0;
            this.vaild = 1;
        } else {
            this.lon = Double.valueOf(lon);
        }
    }

    public Double getLat() {
        return lat;
    }

    public void setLat(String lat) {
        if (lat.equals("999,999") || lat.equals("999,998")) {
            this.lat = 0.0;
            this.vaild = 1;
        } else if (lat.equals("")) {
            this.lat = 0.0;
            this.vaild = 1;
        } else {
            this.lat = Double.valueOf(lat);
        }
    }

    public Double getMaxWind() {
        return maxWind;
    }

    public void setMaxWind(String maxWind) {
        if (maxWind.equals("999,999") || maxWind.equals("999,998")) {
            this.maxWind = 0.0;
        } else if (maxWind.equals("")) {
            this.maxWind = 0.0;
        } else {
            this.maxWind = Double.valueOf(maxWind);
        }
    }

    public String getMaxWindTime() {
        return maxWindTime;
    }

    public void setMaxWindTime(String maxWindTime) {

        if (maxWindTime.equals("999,999") || maxWindTime.equals("999,998")) {
            this.maxWindTime = "00:00";
        } else if (maxWindTime.equals("")) {
            this.maxWindTime = "00:00";
        } else {
            String replace = maxWindTime.replace(",", "");

            // 323->03:23
            if (replace.length() == 3) {
                replace = "0" + replace;
                this.maxWindTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            } else if (replace.length() == 4) {
                // 2330->23:30
                this.maxWindTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            }
        }
    }

    public Double getExtWind() {
        return extWind;
    }

    public void setExtWind(String extWind) {
        if (extWind.equals("999,999") || extWind.equals("999,998")) {
            this.extWind = 0.0;
        } else if (extWind.equals("")) {
            this.extWind = 0.0;
        } else {
            this.extWind = Double.valueOf(extWind);
        }
    }

    public String getExtWindTime() {
        return extWindTime;
    }

    public void setExtWindTime(String extWindTime) {
        if (extWindTime.equals("999,999") || extWindTime.equals("999,998")) {
            this.extWindTime = "00:00";
        } else if (extWindTime.equals("")) {
            this.extWindTime = "00:00";
        } else {
            String replace = extWindTime.replace(",", "");

            // 323->03:23
            if (replace.length() == 3) {
                replace = "0" + replace;
                this.extWindTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            } else if (replace.length() == 4) {
                // 2330->23:30
                this.extWindTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            }
        }
    }

    public Double getMaxTemp() {
        return maxTemp;
    }

    public void setMaxTemp(String maxTemp) {
        if (maxTemp.equals("999,999") || maxTemp.equals("999,998")) {
            this.maxTemp = 0.0;
        } else if (maxTemp.equals("")) {
            this.maxTemp = 0.0;
        } else {
            this.maxTemp = Double.valueOf(maxTemp);
        }
    }

    public String getMaxTempTime() {
        return maxTempTime;
    }

    public void setMaxTempTime(String maxTempTime) {
        if (maxTempTime.equals("999,999") || maxTempTime.equals("999,998")) {
            this.maxTempTime = "00:00";
        } else if (maxTempTime.equals("")) {
            this.maxTempTime = "00:00";
        } else {
            String replace = maxTempTime.replace(",", "");

            // 323->03:23
            if (replace.length() == 3) {
                replace = "0" + replace;
                this.maxTempTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            } else if (replace.length() == 4) {
                // 2330->23:30
                this.maxTempTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            }
        }
    }

    public Double getMinTemp() {
        return minTemp;
    }

    public void setMinTemp(String minTemp) {
        if (minTemp.equals("999,999") || minTemp.equals("999,998")) {
            this.minTemp = 0.0;
        } else if (minTemp.equals("")) {
            this.minTemp = 0.0;
        } else {
            this.minTemp = Double.valueOf(minTemp);
        }
    }

    public String getMinTempTime() {
        return minTempTime;
    }

    public void setMinTempTime(String minTempTime) {
        if (minTempTime.equals("999,999") || minTempTime.equals("999,998")) {
            this.minTempTime = "00:00";
        } else if (minTempTime.equals("")) {
            this.minTempTime = "00:00";
        } else {
            String replace = minTempTime.replace(",", "");

            // 323->03:23
            if (replace.length() == 3) {
                replace = "0" + replace;
                this.minTempTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            } else if (replace.length() == 4) {
                // 2330->23:30
                this.minTempTime = replace.substring(0, 2) + ":" + replace.substring(2, 4);
            }
        }
    }

    public Double getPast24MinTemp() {
        return past24MinTemp;
    }

    public void setPast24MinTemp(String past24MinTemp) {
        if (past24MinTemp.equals("999,999") || past24MinTemp.equals("999,998")) {
            this.past24MinTemp = 0.0;
        } else if (past24MinTemp.equals("")) {
            this.past24MinTemp = 0.0;
        } else {
            this.past24MinTemp = Double.valueOf(past24MinTemp);
        }

    }

    public Double getPast24MaxTemp() {
        return past24MaxTemp;
    }

    public void setPast24MaxTemp(String past24MaxTemp) {
        if (past24MaxTemp.equals("999,999") || past24MaxTemp.equals("999,998")) {
            this.past24MaxTemp = 0.0;
        } else if (past24MaxTemp.equals("")) {
            this.past24MaxTemp = 0.0;
        } else {
            this.past24MaxTemp = Double.valueOf(past24MaxTemp);
        }
    }


    public Integer getVaild() {
        return vaild;
    }

    public void setVaild(Integer vaild) {
        this.vaild = vaild;
    }
}
